package thread._vo;

import lombok.Data;

/**
 * Created mangcao with 2019/5/30 17:52
 * Description:
 */
@Data
public class Student {

    private String name;

    public Student(String name) {
        this.name = name;
    }

    public void _notify() {
        synchronized (this) {
            System.out.println("开始叫你起床");
            notify();
            System.out.println("终于起床了");
        }
    }


    public void _wait(int time) throws InterruptedException {
        synchronized (this) {
            System.out.println("我开始睡觉了,会睡  = " + time);
            if (time <= 0)
                this.wait();
            else
                this.wait(time);
        }

        System.out.println("妈的，终于睡醒了");
    }

}
